<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function add1(){
				let df=document.createDocumentFragment()
				for (var i = 0; i < 10; i++) {
					let text=document.createElement("p")
					text.innerHTML="文字节点"  //改变文本
					text.setAttribute("style","color: red;")
					df.appendChild(text)
				}
				
				document.getElementsByClassName("con")[0].appendChild(df)
			}
			function add2(){
				let df=document.createDocumentFragment()
				for (var i = 0; i < 10; i++) {
					let img=document.createElement("img")
					img.setAttribute("src","../../src/ok.png")
					df.appendChild(img)
				}
				
				document.getElementsByClassName("con")[0].appendChild(df)
			}
		</script>
	</head>
	<body>
		<button type="button" onclick="add1()">添加十个文本</button>
		<button type="button" onclick="add2()">添加十个图片</button>
		<div class="con"></div>
	</body>
</html>
